iT邦幫忙

2025 iThome 鐵人賽

DAY 2
1

昨天了解了 Cloud Native 是什麼,今天就來選平台開始實作,平台有很多可以選擇,有 AWS 、 Azure 、 Oracle Cloud 等等,因為女友的 App 用 Flutter 撰寫,那就先來試試 GCP 來個 Google 全家餐。

Google Cloud

Google Cloud 新用戶可以獲得 300 鎂的額度,在辦好帳號後首先吸引到我的是有個 Cloud Assist 功能,同意資料蒐集後就可以在平台上跟 Gemini 對話,說了我的需求後 Gemini 建議要有以下架構:

  • Global Load Balancer
  • Image Storage (Cloud Storage)
  • Image Upload Service (Cloud Run)
  • LLM Chat Service (Cloud Run)
  • AI/ML Capabilities (Vertex AI)
  • Relational Database (Cloud SQL for PostgreSQL)
  • Secret Management (Secret Manager)

還幫我畫了架構圖:

https://ithelp.ithome.com.tw/upload/images/20250816/20178194VhzSX4fHIa.png

那麼接下來就照著這個架構建環境吧。

Global Load Balancer

進到 GCP 的 Load Balancing 頁面點選 Create load balancer ,接下來就照需求選擇:

  • Type of load balancer 選 Application Load Balancer (HTTP/HTTPS) 來提供 HTTPS API 給 App 使用
  • Public facing or internal 選 Public facing (external) 讓使用者隨處都能使用
  • Global or single region deployment 選 Best for global workloads 期望我們的 App 進軍全球 :p
  • Load balancer generation 選 Global external Application Load Balancer 看起來是新一代的技術就用它吧
  • Frontend configuration 設定名稱及協定,使用 HTTPS 的話要有域名來建立憑證
  • Backend configuration 選 Backend services 來提供後端服務
    • 這邊要先建立一個 Backend service , Backend type 選 Serverless network endpoint group
    • 建立一個 Serverless network endpoint group 要先啟用 Cloud Run Admin API
    • 要先指定一個服務給他,所以先去 Cloud Run 頁面建立一個測試用的 Service
    • Authentication 先選擇 Require authentication
  • 成功建立出一個 Load Balancer!

在看不懂選項時直接問 Gemini 怎麼選真的很方便,只要依照自己的需求選擇即可。不過剛剛新增的 Cloud Run service 設定成 Require authentication 會限制驗證方式要透過 IAM ,應該是以後串 Google 登入只讓允許的帳號存取才會用到,因此先把這個選項改成 Allow public access 就能用 Cloud Run 提供的 URL 直接瀏覽測試用的服務頁面:

https://ithelp.ithome.com.tw/upload/images/20250816/20178194bBGi9Yj7h5.png

而 Global Load Balancer 的部分要等 24 小時讓憑證建立成功後才能存取的樣子,今天就先到這邊,明天確認憑證沒問題後再來依照功能建立需要的 Cloud Run service 。


上一篇
Day1 - Cloud Native 初探
下一篇
Day3 - 讓 Google 幫你管理憑證
系列文
《30 天 Cloud Native:AI 行程規劃後端開發》18
圖片
  熱門推薦
圖片
{{ item.channelVendor }} | {{ item.webinarstarted }} |
{{ formatDate(item.duration) }}
直播中

尚未有邦友留言

立即登入留言